Add User Accounts
2015/03/22 |
Add User Accounts on FreeIPA Server.
|
|
[1] | Add a user. The password set on here is required to change at initial login. |
[root@dlp ~]# ipa user-add cent --first=CentOS --last=Linux --password Password: # set password Enter Password again to verify: ----------------- Added user "cent" ----------------- User login: cent First name: CentOS Last name: Linux Full name: CentOS Linux Display name: CentOS Linux Initials: CL Home directory: /home/cent GECOS field: CentOS Linux Login shell: /bin/bash Kerberos principal: cent@SRV.WORLD Email address: cent@srv.world UID: 1219600001 GID: 1219600001 Password: True Kerberos keys available: True # verify [root@dlp ~]# ipa user-find cent -------------- 1 user matched -------------- User login: cent First name: CentOS Last name: Linux Home directory: /home/cent Login shell: /bin/bash Email address: cent@srv.world UID: 1219600001 GID: 1219600001 Account disabled: False Password: True Kerberos keys available: True ---------------------------- Number of entries returned 1 ---------------------------- |
[2] | Add Existing local Users to IPA Directory ( set the same password with the username on this example, but it is required to change at initial login ) |
[root@dlp ~]#
vi ipauser.sh
# extract local users who have 500-999 digit UID # this is an example #!/bin/bash for line in `grep "x:[5-9][0-9][0-9]:" /etc/passwd` do USER=`echo $line | cut -d: -f1` FIRST=`echo $line | cut -d: -f5 | awk {'print $1'}` LAST=`echo $line | cut -d: -f5 | awk {'print $2'}` [ ! "$FIRST" ] && FIRST=$USER [ ! "$LAST" ] && LAST=$USER echo $USER | ipa user-add $USER --first=$FIRST --last=$LAST --password done sh ipauser.sh ------------------- Added user "redhat" ------------------- User login: redhat First name: redhat Last name: redhat Full name: redhat redhat Display name: redhat redhat Initials: rr Home directory: /home/redhat GECOS field: redhat redhat Login shell: /bin/bash Kerberos principal: redhat@SRV.WORLD Email address: redhat@srv.world UID: 1219600003 GID: 1219600003 Password: True Kerberos keys available: True ------------------- Added user "ubuntu" ------------------- User login: ubuntu First name: ubuntu Last name: ubuntu Full name: ubuntu ubuntu Display name: ubuntu ubuntu Initials: uu Home directory: /home/ubuntu GECOS field: ubuntu ubuntu Login shell: /bin/bash Kerberos principal: ubuntu@SRV.WORLD Email address: ubuntu@srv.world UID: 1219600004 GID: 1219600004 Password: True Kerberos keys available: True |